package pyip.lib.javalearn.aop.dynamicproxy.spring.advisor;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Client {

    public static void main(String[] args) {
        declarationPattern();
        // programPattern();
    }

    private static void declarationPattern() {
        ApplicationContext context = new ClassPathXmlApplicationContext("pyip/lib/javalearn/aop/dynamicproxy/spring/advisor/aop-advisor.xml");
        GreetingAdvisorImpl greeting = (GreetingAdvisorImpl) context.getBean("greetingProxy"); // 注意：转型为目标类，而并非它的 Greeting 接口
        greeting.sayHello("Jack");
        greeting.goodMorning("Jack");
        greeting.goodNight("Jack");

        ((ClassPathXmlApplicationContext) context).close();
    }

    private static void programPattern() {
    }
}